<?php
class auth{
   
	private $CI;
	function __construct(){
		//获取CI超级对象 
		$this->CI = &get_instance();  
	}
	
	public function authorization()
	{
	    global $RTR;
	    //echo $RTR->class;
	    //echo $RTR->method;
		//echo "auth test";
		
	   $this->CI->config->load('acl');	 //加载ACL规则
	   
	   $role = $this->CI->session->userdata("role");  //获取当前用户类型 

	   if(!$role){
	    $this->CI->session->set_userdata("role","anonymous");
	   }
	    $this->CI->logs->logurl();
	    /*
	    switch($role)
	    {
	    	case 'anonymous':
	    		{ 
	    		$acl = $this->CI->config->item("anonymous");  //获取用户所有的权限
	    		
	    		 if(in_array($RTR->class, $acl["class"])){
	    			if(!in_array($RTR->method,$acl["method"])){  //断判用户是否有权限
	    				
	    				//die( "Access deny!");
	    			}
	    		 }else{
	    		   // die( "Access deny!");
	    		 }
	    		 break;
	    		}
	    	case 'manage':
	    		{
	    			
	    			//$acl = $this->CI->config->item("manage");
	    		   // if(in_array($RTR->class, $acl["class"])){
		    			//if(!in_array($RTR->method,$acl["method"])){
		    			//	die( "Access deny!");
		    			//} 
	    		   // }else{
	    		    //   die( "Access deny!");
	    		  //  }
	    		break;
	    		} 
	    }
	    */
	}
	
	
}

